import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const PositioningManagementMeta: ComponentMetadata = {
  componentName: 'PositioningManagement',
  title: '定位管理',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '员工管理',
  category: '数据展示',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'PositioningManagement',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '定位管理',
          },
          {
            name: 'englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Positioning management',
          },
        ],
      },
      {
        title: '定位记录数据',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'positioningRecords',
            title: '定位记录',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'key',
                          title: '唯一标识',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'employee',
                          title: '员工',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'location',
                          title: '位置',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'time',
                          title: '时间',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'callInfo',
                          title: '呼叫信息',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                key: '1',
                employee: '员工1',
                location: '1F大厅',
                time: '14:39',
                callInfo: '意外事故',
              },
              {
                key: '2',
                employee: '员工2',
                location: '1F大厅',
                time: '14:39',
                callInfo: '设备出故障',
              },
              {
                key: '3',
                employee: '员工3',
                location: '1F大厅',
                time: '14:39',
                callInfo: '发生紧急事故…',
              },
              {
                key: '4',
                employee: '员工4',
                location: '1F大厅',
                time: '14:39',
                callInfo: '意外事故',
              },
              {
                key: '5',
                employee: '员工5',
                location: '1F大厅',
                time: '14:39',
                callInfo: '意外事故',
              },
              {
                key: '6',
                employee: '员工6',
                location: '1F大厅',
                time: '14:39',
                callInfo: '设备出故障',
              },
              {
                key: '7',
                employee: '员工7',
                location: '1F大厅',
                time: '14:39',
                callInfo: '发生紧急事故…',
              },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onRowClick',
            title: '行点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'onClick',
            title: '点击事件',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick', 'onRowClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '定位管理',
    screenshot: '',
    schema: {
      componentName: 'PositioningManagement',
      props: {
        title: '定位管理',
        englishTitle: 'Positioning management',
        positioningRecords: [
          {
            key: '1',
            employee: '员工1',
            location: '1F大厅',
            time: '14:39',
            callInfo: '意外事故',
          },
          {
            key: '2',
            employee: '员工2',
            location: '1F大厅',
            time: '14:39',
            callInfo: '设备出故障',
          },
          {
            key: '3',
            employee: '员工3',
            location: '1F大厅',
            time: '14:39',
            callInfo: '发生紧急事故…',
          },
          {
            key: '4',
            employee: '员工4',
            location: '1F大厅',
            time: '14:39',
            callInfo: '意外事故',
          },
          {
            key: '5',
            employee: '员工5',
            location: '1F大厅',
            time: '14:39',
            callInfo: '意外事故',
          },
          {
            key: '6',
            employee: '员工6',
            location: '1F大厅',
            time: '14:39',
            callInfo: '设备出故障',
          },
          {
            key: '7',
            employee: '员工7',
            location: '1F大厅',
            time: '14:39',
            callInfo: '发生紧急事故…',
          },
        ],
      },
    },
  },
];

export default {
  ...PositioningManagementMeta,
  snippets,
};